#ifndef _BSP_TM1650_H
#define _BSP_TM1650_H

#include "driver/gpio.h"

#define     I2C_MASTER_SDA_PORT     GPIO_NUM_3
#define     I2C_MASTER_SCL_PORT     GPIO_NUM_4

#define I2C_MASTER_NUM I2C_NUM_0   /*!< I2C port number for master dev */


/* led输出地址 */
#define LED_DIG1_ADD  0X68
#define LED_DIG2_ADD  0X6A  
#define LED_DIG3_ADD  0X6C
#define LED_DIG4_ADD  0X6E


/* 按键读取值 */
#define KEY_NO_BUTTON_PRESS  0X2E

#define KEY_DIG4_STATUS_PRESS       0X47           // A 开关机
#define KEY_DIG4_TEMPL_PRESS        0X4F           // B 低温
#define KEY_DIG4_TEMPH_PRESS        0X57           // C 高温
#define KEY_DIG4_XUSHI_PRESS        0X5F           // D 虚实模式



typedef enum{
    DIG1 = 0x00,
    DIG2,
    DIG3,
    DIG4,
    DIG_MAX,
}com_type_t;



union dig1_t{
    uint8_t dig1_byte;
    struct {
        uint8_t xu1:1;
        uint8_t shi1:1;
        uint8_t shi2:1;
        uint8_t reserve:5;
    }dig1_bit_t;
};

union dig2_t{
    uint8_t dig2_byte;
    struct {
        uint8_t error1:1;
        uint8_t temp_h1:1;
        uint8_t temp_h2:1;
        uint8_t reserve:5;
    }dig2_bit_t;
};

union dig3_t{
    uint8_t dig3_byte;
    struct {
        uint8_t xu2:1;
        uint8_t temp_l1:1;
        uint8_t temp_l2:1;
        uint8_t reserve:5;
    }dig3_bit_t;
};

union dig4_t{
    uint8_t dig4_byte;
    struct {
        uint8_t error2:1;
        uint8_t on1:1;
        uint8_t on2:1;
        uint8_t reserve:5;
    }dig4_bit_t;
};



void task_tm1650(void* arg);
void TM1650_Init(void);
uint8_t *TM1650_datatrans(void *display_struct);

#endif
